package com.yun.algorithmproblem;

public class Leetcode3477 {

    public static void main(String[] args) {
        Leetcode3477 obj = new Leetcode3477();
        int[] fruits = new int[]{4, 2, 5};
        int[] baskets = new int[]{3, 5, 4};
        int result = obj.numOfUnplacedFruits(fruits, baskets);
        System.out.println(result);
    }

    public int numOfUnplacedFruits(int[] fruits, int[] baskets) {
        int ans = fruits.length;
        for (int fruit : fruits) {
            for (int i = 0; i < baskets.length; i++) {
                if (fruit <= baskets[i]) {
                    baskets[i] = -1;
                    ans--;
                    break;
                }
            }
        }
        return ans;
    }
}


